<?php

namespace App\Admin\Controllers;

use App\Models\Nft;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;

class NftController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(Nft::with(['user']), function (Grid $grid) {
            $grid->column('id')->sortable();
            $grid->column('user_id');
            $grid->column('user.address', '拥有者')->width('120px')->style('word-wrap: break-word;word-break: break-all;white-space: normal;');
            $grid->column('nft_id')->width('120px')->style('word-wrap: break-word;word-break: break-all;white-space: normal;');;
            $grid->column('name');
            $grid->column('img')->image('/storage', 100, 100);
            $grid->column('power');
            $grid->column('minted_amount');
            $grid->column('minted_days');
            $grid->column('days');
            $grid->column('created_at');

            $grid->filter(function (Grid\Filter $filter) {
                $filter->equal('id');
                $filter->equal('user_id');
                $filter->equal('nft_id');
            });

            $grid->disableCreateButton();
            $grid->disableActions();
            $grid->disableBatchActions();
        });
    }
}
